//引入axios 封装接口


import axios from "./config"

//定义请求接口
export const loginApi = (username, password) => axios.post("/api/users/login", {
  username,
  password
})

export const getCaptchaApi = () => axios.get("/api/users/getCaptcha") //获取验证码的接口

export const verifyCaptchaApi = (captcha) =>
  axios.get("/api/users/verifyCaptcha", {
    params: {
      captcha,
    },
  });  //校验验证码的接口

//获取生成二维码的地址
export const getQrcodeUrlApi = () => axios.get("/api/users/getScancode")

export const wechatLoginApi = (wechatCode) => axios.get("/api/users/wechatLogin", {
  params: {
    wechatCode
  }
})
export const getLoginLogApi = (page = 1, count = 10) => axios.get("/api/getloginlog", {
  params: {
    page,
    count
  }
})

//获取权限菜单  =>这个接口一定要用户登陆之后才能获取

export const getMenuLisyApi = () => axios.get("/api/permission/getMenuList")


//期待课程数据

export const expectDataApi = () => axios.get("/data/expect.json")
//折线图数据
export const lineDataApi = () => axios.get("/data/rate.json")

//任务进程数据
export const taskDataApi = () => axios.get("/data/tarsk.json")

//获取学员列表信息
export const getStuListApi = (page = "", count = "5", classes = "") => axios.get("/api/students/getstulist", {
  params: {
    page,
    count,
    class: classes
  }
}
)

//增加学员列表
export const addStuApi = (stuInfo) => axios.post("/api/students/addstu", stuInfo)

//编辑学员列表
export const editStuApi=(stuInfo)=>axios.post("/api/students/updatestu",stuInfo)

//编辑删除信息接口
export const dellStuApi=(sId)=>axios.get("/api/students/delstu",{
  params:{
    sId
  }
})

//获取班级列表
export const getClassesApi=()=>axios.get("/api/students/getclasses")

//根据学员名字搜索学员
export const searchStu = (page = 1, count = "", key = "") =>
  axios.get("/api/students/searchstu", {
    params: {
      page,
      count,
      key,
    },
  });